import mysql from 'mysql';
const connection = mysql.createConnection({
  host: '127.0.0.1',
  user: 'root',
  password: '900601',
  database: 'test'
});
connection.connect((err) => {
  if (err) {
    console.error('Error connecting to MySQL:', err);
    return;
  }
  console.log('Connected to MySQL database.');
});




const StopConnection = ()=>{
    connection.end((err) => {
        if (err) {
          console.error('Error closing connection:', err);
          return;
        }
        console.log('Connection closed.');
      });
}
export  { connection,StopConnection };  
/**
 * 引用参考--- 
 * import * as mysqlUtil from './util/mysql.mjs' 
 * mysqlUtil.test()
 */


